<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="__PUBLIC__/css/pintuer.css">
<link rel="stylesheet" href="__PUBLIC__/css/admin.css">
<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/pintuer.js"></script>
</head>
<body>
<form method="post" action="" id="listform">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 评论列表 </strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" href="javascript:void(0)" onclick="return selectAudit()"> 审核评论</a> </li>
        <li>搜索：</li>
       
        <li>
          <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a></li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">ID</th>
        <th width="100" style="text-align:left; padding-left:20px;">上级ID</th>
        
        <th width="100">名称</th>
        <th width="300">内容</th>
        <th width="100" style="text-align:left; padding-left:20px;">文章ID</th>
        <th width="100">状态</th>
        <th width="100">日期</th>
        <th width="310">操作</th>
      </tr>
      <foreach name='list' item='item'>
        <tr>
          <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id[]" value="{$item.id}" />{$item.id}</td>
          <td>{$item.pid}</td>
          <td>{$item.name}</td>
          <td>{$item.content}</td>
          <td>{$item.aid}</td>
          <td><php>if($item['state']==0){echo '<span style="color:red;">待审</span>';}else{echo '已审';}</php></td>
          <td>{$item.dateline|date="Y-m-d",###}</td>
          <td><div class="button-group"> <a class="button border-main" href="javascript:void(0)" onclick="return audit({$item.id})"><span class="icon-edit"></span> 审核</a> <a class="button border-red" href="javascript:void(0)" onclick="return del({$item.id})"><span class="icon-trash-o"></span> 删除</a> </div></td>
        </tr>
        </foreach>
   		
      <tr>
        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
          全选 </td>
        <td colspan="7" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a> 
        </td>
      </tr>
      <tr>
        <td colspan="8" class="page-list"><div class="pagelist"> {$page} </div></td>
      </tr>
    </table>
  </div>
</form>
<script type="text/javascript">

//搜索
function changesearch(){	
	$("#listform").attr("action","__URL__/index.html");
	$("#listform").submit();	
	
}
//审核
function audit(id){	
	$("#listform").attr("action","__URL__/audit/id/"+id+".html");
	$("#listform").submit();	
	
}

//单个删除
function del(id){
	if(confirm("您确定要删除吗?")){
		
		$("#listform").attr("action","__URL__/del/id/"+id+".html");
		$("#listform").submit();	
		
	}
}

//全选
$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

//批量删除
function DelSelect(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;	
		$("#listform").attr("action","__URL__/delselect");
		$("#listform").submit();		
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

function selectAudit(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		/* var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;	 */
		$("#listform").attr("action","__URL__/selectAudit");
		$("#listform").submit();		
	}
	else{
		alert("请选择您要审核的内容!");
		return false;
	}
}

</script>
</body>
</html>